from abc import ABC, abstractmethod


class Finder(ABC):

    # 返回支持的文件后缀列表，比如["pdf", "txt"]
    @staticmethod
    def file_suffixes():
        pass

    # 根据路径，和搜索目录，搜索文件
    @abstractmethod
    def search_file(self, file_path, search_content):
        pass

    @staticmethod
    def ignore_paths():
        return ["废弃"]

    @staticmethod
    def process_text_if_need(origin_text):
        return origin_text.replace("\n", "")

    @staticmethod
    def should_file_path_ignore(file_path):
        for ignore in Finder.ignore_paths():
            if ignore in file_path:
                return True
        return False



